import { useState } from 'react';

export const useAvailablePets = () => {
  const [availablePets, setAvailablePets] = useState([]);

  const generateAvailablePets = () => {
    const petTypes = ['cat', 'dog', 'rabbit', 'hamster'];
    const petNames = {
      cat: '小咪',
      dog: '旺财',
      rabbit: '兔兔',
      hamster: '仓仓'
    };
    const petEmojis = {
      cat: '🐱',
      dog: '🐶',
      rabbit: '🐰',
      hamster: '🐹'
    };
    
    const mapWidth = 800;
    const mapHeight = 600;
    
    const pets = [];
    for (let i = 0; i < 1; i++) {
      const randomType = petTypes[Math.floor(Math.random() * petTypes.length)];
      pets.push({
        id: `pet-${i}`,
        type: randomType,
        name: petNames[randomType],
        emoji: petEmojis[randomType],
        position: {
          x: Math.random() * (mapWidth - 100) + 50,
          y: Math.random() * (mapHeight - 100) + 50
        },
        element: null
      });
    }
    
    setAvailablePets(pets);
  };

  return [availablePets, setAvailablePets, generateAvailablePets];
};